package com.gms.action;

import com.gms.domain.Product;
import com.gms.service.ProductService;
import com.opensymphony.xwork2.ActionSupport;

public class ShowProductInfoAction extends ActionSupport {
	private ProductService productService;
	private Integer productId;
	private Product product;
	public ProductService getProductService() {
		return productService;
	}
	public void setProductService(ProductService productService) {
		this.productService = productService;
	}
	public Integer getProductId() {
		return productId;
	}
	public void setProductId(Integer productId) {
		this.productId = productId;
	}
	public Product getProduct() {
		return product;
	}
	public void setProduct(Product product) {
		this.product = product;
	}
	
	public String showProductInfo(){
	
		product = productService.findProductById(productId);
		product.setBrowTimes(product.getBrowTimes() + 1);
		productService.update(product);
		return "success";
	}
}
